<?php
    App::import('Vendor','xtcpdf');  
    $tcpdf = new XTCPDF(); 
    $textfont = 'freesans'; // looks better, finer, and more condensed than 'dejavusans' 

    $tcpdf->SetAuthor("Centro de idiomas universidad de los llanos"); 
    $tcpdf->SetMargins(13,60,10,true);
    $tcpdf->SetAutoPageBreak( true ); 
    $tcpdf->SetFont($textfont,'empty string',9); 
    $tcpdf->AddPage();
    $fin_table = '</table>';
    $cabecera = '<h4>DOCENTE: '.$teacherName.'</h4>
                 <h4>CURSO: '.$cursoSelect.'</h4>
                 <h4></h4>
            <table border="1" cellspacing="0" cellpadding="3">
                <tr>
                    <th align="center" width="80">N° Identificación</th>
                    <th align="center" width="190">Apellidos Nombres</th>
                    <th align="center" width="50">Nota1</th>
                    <th align="center" width="50">Nota2</th>
                    <th align="center" width="50">Nota3</th>
                    <th align="center" width="50">Nota4</th>
                    <th align="center" width="50">Final</th>
                </tr> ';
    foreach ($listado as $row) {
        $contenido .= '
            <tr>
                <td>'.$row['ciuuser_S']['document'].'</td>
                <td>'.$row['0']['studentName'].'</td>
                <td align="right">'.$row['ciucourse_ciustudent']['score1'].'</td>
                <td align="right">'.$row['ciucourse_ciustudent']['score2'].'</td>
                <td align="right">'.$row['ciucourse_ciustudent']['score3'].'</td>
                <td align="right">'.$row['ciucourse_ciustudent']['score4'].'</td>
                <td align="right">'.$row['ciucourse_ciustudent']['total_score'].'</td>
            </tr>
        ';
    }
    $html=$cabecera.$contenido.$fin_table;
    // output the HTML content
    $tcpdf->writeHTML($html, true, false, true, false, '');
    //Close and output PDF document
    $tcpdf->Output('example_006.pdf', 'I');
?>
